/**
 * @author kevinlaizhiyu@foxmail.com
 * @description user model
 * @date 2024-6-6
 * @version 1.0.0
 */
import mongoose, { Schema } from "mongoose";
const { ObjectId } = mongoose.Types;

// 定义 Venue 接口
export interface IVenue {
  venueId: string;
  venueName: string;
  address: string;
  courtId: string[]; // 场地ID数组
  status: boolean;
  comment: string;  
  createdAt: number;
  updatedAt: number;
}

// 定义 Venue Schema
const venueSchema = new Schema({
  venueId: {
    type: String,
    default: () => new ObjectId(),
    index: true,
    unique: true,
  }, // 场馆ID
  venueName: { type: String, required: true }, // 地址
  address: { type: String, required: true }, // 地址
  status: { type: Boolean, default: true }, // 状态
  comment: { type: String, required: true }, // 地址
  createdAt: { type: Number, default: Date.now }, // 创建时间
  updatedAt: { type: Number, default: Date.now }, // 更新时间
});

// 创建 Venue 模型
const VenueModel = mongoose.model("venues", venueSchema);

export default VenueModel;
